﻿using System;
using EasyStep.Attributes;
using EasyStep.TestExecution.Data;
using EasyStep.TestExecution.Interfaces;

using ArtOfTest.WebAii.Core;
using ArtOfTest.WebAii.Controls.HtmlControls;
using EasyStep.TestActions.WebAii;


namespace EasyStep.TestActions.Actions
{
    [TestAction(typeof(AssertAction), Name = "ByLinkText", RequireData = false)]
    public class AssertByLinkText : ITestAction<Manager>
    {
        public void Execute(Manager browser, TestStepResult data, IExecuteDataContext context)
        {
            HtmlAnchor result = browser.FindLinkByText(data.Locator);
            if (result == null)
                throw new ArgumentOutOfRangeException("Can't find link with text:" + data.Locator);
        }
    }
}